package com.ft.oa.web.project;

import com.ft.oa.domain.check.ExecProjectProblem;
import com.ft.oa.domain.dto.ApiResult;
import com.ft.oa.domain.dto.project.ExecProjectPage;
import com.ft.oa.domain.project.ProjectWarranty;
import com.ft.oa.domain.project.ProjectWarrantyPage;
import com.ft.oa.domain.project.WarrantyReturnedMoney;
import com.ft.oa.domain.project.WarrantyReturnedRecord;
import com.ft.oa.service.project.ProjectWarrantyService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 项目质保期管理
 * @author liyansheng
 * @ClassName ProjectWarrantyController
 * @date 2021/12/30 10:47
 */
@RestController
@RequestMapping("/projectWarranty")
public class ProjectWarrantyController {

    @Resource
    private ProjectWarrantyService projectWarrantyService;

    /**
     * @param projectWarrantyPage
     * @describe 质保期分页
     * @author liyansheng
     * @date 2022-1-14 10:44:37
     */
    @PostMapping("/page")
    public ApiResult page(@RequestBody ProjectWarrantyPage projectWarrantyPage){
        return projectWarrantyService.page(projectWarrantyPage);
    }
    /**
     * 查找待解决问题 examine_id
     */
    @PostMapping("/execproblem")
    public ApiResult execproblem(@RequestBody ProjectWarrantyPage projectWarrantyPage){
        return ApiResult.successWithData(projectWarrantyService.execproblem(projectWarrantyPage));
    }
    /**
     * @param warrantyReturnedMoney
     * @describe 新增回款记录
     * @author liyansheng
     * @date 2022-1-14 10:44:37
     */
    @PostMapping("/addMoney")
    public ApiResult addMoney(@RequestBody WarrantyReturnedMoney warrantyReturnedMoney){
        return projectWarrantyService.addMoney(warrantyReturnedMoney);
    }

    /**
     * @param warrantyReturnedRecord
     * @describe 新增质保记录
     * @author liyansheng
     * @date 2022-1-14 10:44:37
     */
    @PostMapping("/addRecord")
    public ApiResult addRecord(@RequestBody WarrantyReturnedRecord warrantyReturnedRecord){
        return projectWarrantyService.addRecord(warrantyReturnedRecord);
    }

    /**
     * @param projectWarranty
     * @describe 编辑质保
     * @author liyansheng
     * @date 2022-1-14 10:44:37
     */
    @PostMapping("/edit")
    public ApiResult edit(@RequestBody ProjectWarranty projectWarranty){
        return projectWarrantyService.edit(projectWarranty);
    }

    /**
     * @param id
     * @describe 详情
     * @author liyansheng
     * @date 2022-1-14 10:44:37
     */
    @PostMapping("/detail/{id}")
    public ApiResult detail(@PathVariable Long id){
        return projectWarrantyService.detail(id);
    }
    /**
     * 新增运维问题
     */
    @PostMapping("/addmaintenance")
    public ApiResult addmaintenance(@RequestBody ExecProjectProblem execProjectProblem){
        return projectWarrantyService.addmaintenance(execProjectProblem);
    }
}
